package com.workstudy.wstudy.controller;

import com.workstudy.common.core.controller.BaseController;
import com.workstudy.common.core.domain.AjaxResult;
import com.workstudy.wstudy.domain.WstApply;
import com.workstudy.wstudy.domain.WstPost;
import com.workstudy.wstudy.domain.WstPostUser;
import com.workstudy.wstudy.domain.WstRecord;
import com.workstudy.wstudy.service.IWstApplyService;
import com.workstudy.wstudy.service.IWstProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/wstudy/process")
public class WstProcessController extends BaseController {

    @Autowired
    private IWstProcessService processService;

    /**
     * 负责人提交给管理员审核
     * @param post
     * @return
     */
    @PostMapping("/submit")
    @ResponseBody
    public AjaxResult submitPost(WstPost post){
        return toAjax(processService.submitPost(post));
    }

    /**
     * 管理员检查负责人提交的岗位信息
     * @param record
     * @return
     */
    @PostMapping("/examinePost")
    @ResponseBody
    public AjaxResult examinePost(WstRecord record){
        return toAjax(processService.examinePost(record));
    }

    /**
     * 学生申请信息
     * @param apply
     * @return
     */
    @PostMapping("/apply")
    @ResponseBody
    public AjaxResult apply(WstApply apply){
        return toAjax(processService.apply(apply));
    }

    /**
     * 负责人审核学生信息
     * @param record
     * @return
     */
    @PostMapping("/examineApply")
    @ResponseBody
    public AjaxResult examineApply(WstRecord record){
        return toAjax(processService.examineApply(record));
    }

    /**
     * 选择offer
     * @param apply
     * @return
     */
    @PostMapping("/offer")
    @ResponseBody
    public AjaxResult offer(WstApply apply){
        return toAjax(processService.offer(apply));
    }

    /**
     * 辞退
     * @param postUser
     * @return
     */
    @PostMapping("/dismissal")
    @ResponseBody
    public AjaxResult dismissal(WstPostUser postUser){
        return toAjax(processService.dismissal(postUser));
    }

    /**
     * 结束招聘岗位
     * @param post
     * @return
     */
    @PostMapping("/finished")
    @ResponseBody
    public AjaxResult finished(WstPost post){
        return toAjax(processService.finished(post));
    }
}
